<?php
/**
 * @date: 2019年11月6日
 * @author: [欢乐逗、、] QQ：1242821087
 * @说明: 删除以及更改版权者死全家
 */

header("Access-Control-Allow-Origin:*"); // 跨域处理
header("Content-type: text/html; charset=utf-8");
error_reporting(0);
ini_set('date.timezone', 'Asia/Shanghai');
/**
 * 数据库连接
 */
$pdo = new PDO("mysql:host=127.0.0.1;dbname=cq_account", "cq_dba", "123456abc");
$pdo->exec('set names utf8');
function getstr($str)
{
 if (isset($_GET[$str])) {
  return $_GET[$str];
 }
 die('{"ret":9}');
 //die ( "Request param error" );
}

function getkey($a, $b)
{
 $loginkey = '1242821087';
 $key      = md5($a . '&' . $b . '&' . $loginkey);
 return $key;
}

function getip()
{
 static $realip;
 if (isset($_SERVER)) {
  if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
   $realip = $_SERVER['HTTP_X_FORWARDED_FOR'];
  } else if (isset($_SERVER['HTTP_CLIENT_IP'])) {
   $realip = $_SERVER['HTTP_CLIENT_IP'];
  } else {
   $realip = $_SERVER['REMOTE_ADDR'];
  }
 } else {
  if (getenv('HTTP_X_FORWARDED_FOR')) {
   $realip = getenv('HTTP_X_FORWARDED_FOR');
  } else if (getenv('HTTP_CLIENT_IP')) {
   $realip = getenv('HTTP_CLIENT_IP');
  } else {
   $realip = getenv('REMOTE_ADDR');
  }
 }
 return $realip;
}
